Add an initial version of a preferences dialog - #2261
Conversation
- Use the libadwaita preferences dialog, and define the layout using an xml .ui file to test out this process for the first time. - Move the color scheme preference into the dialog as a test. By adding an event when settings are modified, changes to the settings can be decoupled from the dialog itself - Add a Preferences menu item. Depending on the platform, this is in the application menu on macOS, or in the Edit menu for a menubar layout, or in the main menu when using a headerbar layout. - Also simplified logic around how the macOS app menu commands are registered, and fixed the keyboard shortcut dialog to use different shortcuts from the prefs dialog
|
Great that you like the UI files 👍 If your solution for translations can be supported by GirCore we can try to upstream it or parts of it. There is already a ticket to improve the UI file translation situation but without any concrete idea yet: gircore/gir.core#1482 |
|
One option would be to extend the The other approach I've been looking at is just having Pinta use the native We already bundle libintl since it's used by GTK, libadwaita, etc, so using this is pretty reasonable and just requires a few bindings for the native functions. The |
|
I think you can already provide custom resource loaders so influencing the xml is already possible. Adding another configuration point inside it feels a little much to me. It sounds pretty great to use the gettext package. One idea which came to my mind is to just let the user use an attribute on assembly level like In this way if you call it everything gets setup automatically including language and subclass registration. |
|
Agreed, I think it should be doable as-is to provide a custom resource loader - it's just more work to implement the parsing. But IMO using the native gettext will probably be the easiest avenue for most users. Initializing gettext can involve some runtime configuration (e.g. to come up with the folder path that gettext should load from, or possibly changing the language-related env vars to override the default language selection), so my initial thinking was to just start with some straightforward bindings that mirror the C api before trying to come up with a higher-level utility? |
|
Yes this would be possible too. I suggested the attribute instead of an API because:
If I use an attribute and generate the code in the user project I don't need a new Nuget and it's more like a configuration. I don't know if there are lots of possibilities to use gettext? I thought it's always the same 3 calls in order and that's it. Do you know otherwise? |
Description of Changes
Use the libadwaita preferences dialog, and define the layout using a
.uifile to test out this process for the first time (works quite well!).Move the color scheme preference into the dialog as a test. By adding an event when settings are modified, changes to the settings can be decoupled from the dialog itself
Add a Preferences menu item. Depending on the platform, this is in the application menu on macOS, or in the Edit menu for a menubar layout on other platforms, or in the main menu when using a headerbar layout.
TODO: figure out how to translate the .ui file. If we used the native gettext library for our translations this would just work automatically, so perhaps we should attempt to do this? Otherwise we need to implement a custom loader which translates the xml file using our
Translations.GetString()functionChecklist